local skill = fk.CreateSkill{
  name = "iberia__zhenwei",
}

local I = require "packages/iberia/utility"

Fk:loadTranslationTable{
  [skill.name] = "镇卫",
  [":"..skill.name] = "同势力角色受到伤害后，你可以令伤害来源摸一张牌且不能使用颜色与伤害来源牌相同的牌直到回合结束。",
  [skill.name.."-ivk"] = "镇卫：可以令 %src 摸一张牌且不能使用 %arg 牌直到回合结束。",
  ["@"..skill.name.."-turn"] = "镇卫",
}

skill:addEffect(fk.Damaged, {
  anim_type = "control",
  can_trigger = function (self, event, target, player, data)
    if player:hasSkill(skill.name) then
      return I.isMate(target, player)
    end
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askToSkillInvoke(player, {
      skill_name = skill.name,
      prompt = skill.name.."-ivk:"..data.from.id.."::"..Fk:translate(data.card:getColorString()),
    })
  end,
  on_use = function (self, event, target, player, data)
    data.from:drawCards(1, skill.name)
    local colors = player:getTableMark("@"..skill.name.."-turn")
    table.insertIfNeed(colors, data.card:getColorString())
    player.room:setPlayerMark(data.from, "@"..skill.name.."-turn", colors)
  end,
})

skill:addEffect("prohibit", {
  global = true,
  prohibit_use = function (self, player, card)
    return table.contains(player:getTableMark("@"..skill.name.."-turn"), card:getColorString())
  end
})

return skill